﻿using UnityEngine;
using System;
using System.Collections;

namespace Baiyy {
	namespace Controllers {
		/// <summary>
		/// 基础控制器。
		/// </summary>
		public class BaseController : MonoBehaviour {

			#region methods

			void Awake() {
				InitData ();
			}

			void Start () {
				InitState ();
				InitView ();
			}

			void Update () {
				UpdateData ();
				UpdateState ();
				UpdateView ();
			}

			void OnDestroy() {
				DestroyView ();
				DestroyState ();
				DestroyData ();
			}

			#endregion

			#region virtuals

			/// <summary>
			/// 初始化数据。
			/// </summary>
			protected virtual void InitData() {
				throw new NotImplementedException ();
			}

			/// <summary>
			/// 初始化状态。
			/// </summary>
			protected virtual void InitState() {
				throw new NotImplementedException ();
			}

			/// <summary>
			/// 初始化视图。
			/// </summary>
			protected virtual void InitView() {
				throw new NotImplementedException ();
			}

			/// <summary>
			/// 更新数据。
			/// </summary>
			protected virtual void UpdateData() {
				throw new NotImplementedException ();
			}

			/// <summary>
			/// 更新状态。
			/// </summary>
			protected virtual void UpdateState() {
				throw new NotImplementedException ();
			}

			/// <summary>
			/// 更新视图。
			/// </summary>
			protected virtual void UpdateView() {
				throw new NotImplementedException ();
			}

			/// <summary>
			/// 销毁数据。
			/// </summary>
			protected virtual void DestroyData() {
				throw new NotImplementedException ();
			}

			/// <summary>
			/// 销毁状态。
			/// </summary>
			protected virtual void DestroyState() {
				throw new NotImplementedException ();
			}

			/// <summary>
			/// 销毁视图。
			/// </summary>
			protected virtual void DestroyView() {
				throw new NotImplementedException ();
			}
			#endregion
		}
	}
}
